/*
 * @Author: 余文童
 * @Date: 2020-08-10 10:53:10
 * @LastEditTime: 2020-08-13 01:37:27
 * @LastEditors: Please set LastEditors
 * @Description: 用户服务实现类
 * @FilePath: \BackEnd\saleflower\src\main\java\com\wangwang\saleflower\service\impl\UserServiceImpl.java
 */
package com.wangwang.saleflower.service.impl;

import com.wangwang.saleflower.entity.User;
import com.wangwang.saleflower.mapper.UserMapper;
import com.wangwang.saleflower.service.UserService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> selectUserList() {
        return userMapper.selectAllUser();
    }

    @Override
    public User getUserByName(String userName) {
        return userMapper.selectUserByName(userName);
    }

    @Override
    public void saveUser(User user) {
        userMapper.addUser(user);
    }

    @Override
    public boolean isUserExist(String userName) {
        return userMapper.selectUserByName(userName) != null;
    }

    @Override
    public void updateUserInfo(User newUser) {
        userMapper.updateUser(newUser);
    }

    @Override
    public void removeUserByName(String name) {
        userMapper.removeUserByName(name);
    }

}
